package net.ulrice.mdls.sensor;

import net.ulrice.mdls.sensor.facade.SensorService;

import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.server.TThreadPoolServer.Args;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class MdlsSensor {

	private static final Logger LOG = LoggerFactory.getLogger(MdlsSensor.class);
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static void main(String[] args) throws Exception, SensorException {
		SensorService.Processor processor = new SensorService.Processor(new MdlsSensorFacadeHandler(new UnixProcSensor()));			
		TServerTransport serverTransport = new TServerSocket(9080);		
		TServer server = new TThreadPoolServer(new Args(serverTransport).processor(processor));		
		
		LOG.info("Mdls-Sensor started at port 9080");
		server.serve();
	}	
}
